<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	request.setCharacterEncoding("UTF-8");
	String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
</head>
<style>
	.div_input {
		width: 500px;
		height: 40px;
	}
</style>
<body  style="background: #f5f5f5">
<div class="main">
	<div class="weizhi">
		车辆基础资料>>维修项目>>新增
	</div>
	<div class="div_body" style="box-shadow: 0 0 5px #cccccc;">
		<div class="div_form">
			<form action="<%=path%>/DrivingSys/addMaintainItem" class="form" onsubmit="return submit2();" method="post">
				<div class="fwrz">
					<div class="div_input">
						<span class="gn_name">驾校&nbsp;:&nbsp;</span>
						<input type="text" readonly="readonly" value="${department.fnameL2}" style="color: gray;">
					</div>
					<div class="div_input">
						<span class="gn_name">编码&nbsp;:&nbsp;</span>
						<input type="text" name="fnumber" value="${fnumber}" readonly="readonly" style="color: gray;">
					</div>
					<div class="div_input">
						<span class="gn_name">名称&nbsp;:&nbsp;</span>
						<input type="text" name="fnameL2" class="name">
                        <span class="required">必填</span>
					</div>
					<div class="div_input">
						<span class="gn_name">保修期&nbsp;:&nbsp;</span>
						<input type="text" name="fsimplename">
					</div>
					<div class="div_input">
						<span class="gn_name">工时&nbsp;:&nbsp;</span>
						<input type="text" name="cfmanhours" id="gs">
						<span style="font-size: 14px;color: red;display: none" class="haoyou">请输入数字</span>
					</div>
					<div class="div_input">
						<span class="gn_name">单价&nbsp;:&nbsp;</span>
						<input type="text" name="cfprice" id="dj">
						<span style="font-size: 14px;color: red;display: none" class="jiage">请输入数字</span>
					</div>
					<div class="div_input">
						<span class="gn_name">修理厂&nbsp;:&nbsp;</span>
							<select style="width: 234px;height: 31px" name="cfrepairshopid">
								<option value="" style="font-size: 16px">请选择修理厂</option>
							 		<c:forEach items="${repairShops}" var="repairShops" >
							 			<option value="${repairShops.fid}" style="font-size: 16px">${repairShops.fnameL2}</option>
							 		</c:forEach>
							 </select>
					</div>
					<div class="div_input">
						<span class="gn_name">描述&nbsp;:&nbsp;</span>
						<input type="text" name="fdescriptionL2">
					</div>
				</div>
				<div class="div_tj" style="margin-left: 140px">
					<div>
                        <input type="submit" class="input_submit bc" value="" style="margin-right: 30px;">
					</div>
					<div>
                        <input type="button" class="input_back fh" value="" onclick="back()"/>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script type="text/javascript">
$(document).ready(function(){
	var type = "${type}"
	if(type == null || type == ''){
		
	}else{
        editAlert();
	}
})
	
	$("#gs").blur(function(){
		//只能输入数字和小数点
		var re = /^\d+(?=\.{0,1}\d+$|$)/ 
		//理论油耗的值
		var gs = $(this).val();
		//判断只能输入数字和小数点
		if(gs == ""){
			$(".haoyou").css("display","none");
		}else if(!re.test(gs)){
			$(".haoyou").css("display","inline");
			$(this).val("")
		}else{
			$(".haoyou").css("display","none");
		}
	})
	
	$("#dj").blur(function(){
		//只能输入数字和小数点
		var re = /^\d+(?=\.{0,1}\d+$|$)/ 
		//理论油耗的值
		var dj = $(this).val();
		//判断只能输入数字和小数点
		if(dj == ""){
			$(".jiage").css("display","none");
		}else if(!re.test(dj)){
			$(".jiage").css("display","inline");
			$(this).val("")
		}else{
			$(".jiage").css("display","none");
		}
	})

//阻止表单提交
function submit2(){
	var name = $(".name").val();
	if(name == null || name == ''){
		alert("名称不能为空")
		return false
	}
    //提交后把提交变成不可用，可阻止表单重复提交
    $("input[type='submit']").attr("disabled", "disabled");
}
	
	function back(){
		location = '<%=path%>/DrivingSys/queryMaintainItem/look.action';
	}
</script>
</html>